#ifndef frm_control_TParaEdit_H
#define frm_control_TParaEdit_H

#include "svl_TText.h"
#include "frm_control_TPara.h"
#include "frm_control_TString.h"

namespace frm { namespace control {

///////////////////////////////////////////////////////////////////////////////

struct TParaEdit : public TPanel
{
  struct TStyle : public frm::TStyle
  {
    svl_Type(frm::TStyle)
    TPanel::TStyle Normal;
    //TPara::TStyle Para;
    //
    virtual void SetFromParent(frm::TStyle *Parent);
    virtual svl::TInfoParam AddInfoTo(svl::TInfoParam Info);
  };
  //
  svl_Type(TPanel)
  TParaEdit(TWindow &Window);
 ~TParaEdit();
  //
  void SetStyle(TStyle &V) { TPanel::SetStyle(V.Normal); style = &V;}
  //
  void WAlignChildrenPara(geometry::TAlignChildren &V);
  void WAlignChildrenPara_Left  () { WAlignChildrenPara(geometry::TBegin()); }
  void WAlignChildrenPara_Center() { WAlignChildrenPara(geometry::TCenter()); }
  void WAlignChildrenPara_Right () { WAlignChildrenPara(geometry::TEnd()); }
  //
  void SetAttrPara(TPara *Para);
  void SetEnFormatting(bool V = false) { enFormatting = V;}
  bool GetEnFormatting()               { return enFormatting;}
  //
  void AddPara(svl::TString V,TString::TStyle *StringStyle = NULL);
  //
  void LoadFromText(svl::TText &Text,TString::TStyle *StringStyle = NULL);
  void SaveToText  (svl::TText &Text);

private:
  TPara *NewPara();
  //
  virtual void TComponent_KeyboardKey(grf::TKeyboardKey &KeyboardKey);
  virtual void TComponent_AfterChangeWidth(int OldVal,int NewVal);
  virtual void TComponent_AfterAddChild(TComponent *Child);
  virtual void TComponent_InheritStyleFrom(TTableOfStyles &ParentStyles);
  //
  bool enFormatting;
  geometry::TAlignChildren *wAlignChildrenPara;
  TStyle *style;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
}}

#endif
